<template>
  <div class="assetsOrder">
    <div class="assetsOrder-top">
			<span>
				<van-icon name="arrow-left"/>
			</span>
      <span>红包/代金券领取</span>
    </div>
    <div class="assetsOrder-data">
      <div class="assetsOrder-list">
        <div class="listOrder-top">
          <div class="listOrder-left">
            <span>{{cashCouponName}}</span>
            <span>有效期至{{ deadline }}</span>
          </div>
          <div class="listOrder-right">
            <span><span>￥</span><span class="right-jine">{{ preferentialAmount }}</span></span>
            <span>满{{ threshold }}可用</span>
          </div>
        </div>
        <div class="listOrder-bottom">
          <el-button :disabled="disabledEditOne" @click="getAssetsAddOne()">领取</el-button>
        </div>
      </div>
      <div class="assetsOrder-list">
        <div class="listOrder-top">
          <div class="listOrder-left">
            <span>{{cashCouponName}}</span>
            <span>有效期至{{ deadline }}</span>
          </div>
          <div class="listOrder-right">
            <span><span>￥</span><span class="right-jine">{{ preferentialAmount }}</span></span>
            <span>满{{ threshold }}可用</span>
          </div>
        </div>
        <div class="listOrder-bottom">
          <el-button :disabled="disabledEditTwo" @click="getAssetsAddTwo()">领取</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: "AssetsCasCouponList",
  data() {
    return {
      cashCouponName: '天天神券',
      preferentialAmount: 5,
      threshold: 20,
      tishi:'',
      disabledEditOne:false,
      disabledEditTwo:false,
    }
  },
  methods: {
    getAssetsAddOne(){
        this.$axios.post('/assets/add',{
          threshold:this.threshold,
          preferentialAmount:this.preferentialAmount,
          shopId:0
        })
      .then(res => {
        this.tishi = res.jg
      })
      this.disabledEditOne=true;
    },
    getAssetsAddTwo(){
       this.$axios.post('/assets/add',{
         threshold:this.threshold,
         preferentialAmount:this.preferentialAmount,
         shopId:0
       })
     .then(res => {
       this.tishi = res.jg
     })
      this.disabledEditTwo=true;
    }
  }
}
</script>

<style scoped>
.assetsOrder {
  background: #F2F2F2;
  display: flex;
  flex-direction: column;
  font-family: "楷体";
}

.assetsOrder-top {
  height: 30px;
  width: 100%;
  background: #FFFFFF;
  position: fixed;
  top: 0;
}

.assetsOrder-top span:nth-of-type(1) {
  margin-left: 20px;
  margin-right: 20px;
}

.assetsOrder-top span:nth-of-type(2) {
  font-weight: 700;
}

.right-jine {
  font-size: 28px;
}

.assetsOrder-data {
  margin-top: 50px;
  display: flex;
  flex-wrap: wrap;
}

.assetsOrder-list {
  background: #FFFFFF;
  height: 130px;
  width: 48%;
  border-radius: 10px;
  margin: auto;
  margin-bottom: 10px;
}

.listOrder-top {
  display: flex;
  flex-direction: row;
  padding-top: 10px;
}

.listOrder-left {
  display: flex;
  flex-direction: column;
  width: 95%;
}

.listOrder-left span:nth-of-type(1) {
  font-size: 20px;
  font-weight: bold;
}

.listOrder-left span:nth-of-type(2) {
  font-size: 14px;
  font-weight: 500;
}

.listOrder-right {
  color: red;
  display: flex;
  flex-direction: column;
}
.listOrder-bottom{

}
</style>
